﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
    var areacode = ViewBag.areaCode;
    ItemListBox<Product> productlist = ViewBag.productList;
    var type = ViewBag.Type;
}
<div class="container">
    <ul class="breadcrumb">
        <li><a href="../home/index">首页</a> <span class="divider">></span></li>
        <li class="active">校园团购</li>
    </ul>
    <div class="row">
        <div class="span12">
            <!--//////////////////////////////////////////////////////////////////////////////////-->
            @{
                int j = 0;
                if (productlist != null && productlist.Data != null && productlist.Data.Any())
                {
                    int count = productlist.Data.Count();
                    foreach (var item in productlist.Data)
                    {
                        double price = (double)item.DefaulSalePrice;
                        double originalPrice = (double)item.OriginalPrice;
                        string url = "/shop/ProductItemView?id=" + item.Id;
                        decimal discount = 10;
                        discount = Math.Round(item.DefaulSalePrice / item.OriginalPrice * 10, 2);
                        if (j % 3 == 0)
                        {
                            @:<div class="row-fluid">
                                <div class="span4 group-on">
                                    <!--cover:320x180-->
                                    <a href="@url"  target="_blank" >
                                        <img src="@item.Images" /></a>
                                    
                                    <div>
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span8">
                                            <span class="red price-large">&yen;@price</span>
                                        </div>
                                        <div class="span4 text-right">
                                            <a href="@url"  target="_blank" class="btn-group-on"></a>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span8">
                                            <span class="muted" style="vertical-align:middle">价值&nbsp;<s>&yen;@originalPrice</s>&nbsp;|&nbsp;@discount 折</span>
                                        </div>
                                        <div class="span4">
                                            <div class="text-right">
                                                <span class="muted"><span class="icon-user"></span>&nbsp;<span class="red">@item.SaleCount</span>人团购</span>
                                            </div>
                                        </div>
                                    </div>
                            </div>
                        }
                        else
                        {
                            <div class="span4 group-on">
                                    <!--cover:320x180-->
                                    <a href="@url"  target="_blank" >
                                        <img src="@item.Images" /></a>
                                    
                                    <div>
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span8">
                                            <span class="red price-large">&yen;@price</span>
                                        </div>
                                        <div class="span4 text-right">
                                            <a href="@url"  target="_blank"  class="btn-group-on"></a>
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span8">
                                            <span class="muted" style="vertical-align:middle">价值&nbsp;<s>&yen;@originalPrice</s>&nbsp;|&nbsp;@discount 折</span>
                                        </div>
                                        <div class="span4">
                                            <div class="text-right">
                                                <span class="muted"><span class="icon-user"></span>&nbsp;<span class="red">@item.SaleCount</span>人团购</span>
                                            </div>
                                        </div>
                                    </div>
                            </div>
                        }
                        if (j % 3 == 2 || (j + 1) == count)
                        {
                             @:</div>
                             <br />
                        }
                        j++;
                    }
                }
                else
                {
                   <div style="margin-left:80px; margin-top:50px"><p style="vertical-align:middle">
                <b style="font-size: 20px; color: Green">即将开启，敬请期待！</b></p></div>
                 
                }
            }
             
            <!--分页-->
            <div class="pagination text-right">
                <hr />
                <div class="text-left span3">
                    </div>
                  @Html.Raw(productlist.PageItemSegment)
            </div>
            <!--#分页-->
        </div>
    </div>
</div>